<?

class osAdsl extends osGeneric {
	public $id = 'adsl';
	public $tabs = array(
		'interfaces'=>'Interfaces'
	);
	
	public $dataCollectors = array(
		'getIPStatistics',
		'getNetStatistics'
	);
	
	public function getResources() {
	
		// Device Information
		foreach ($this->device->snmp->find('HOST-RESOURCES-MIB','hrDeviceIndex') AS $key=>$index) {
			$item = $this->device->snmp->find('HOST-RESOURCES-MIB','hrDevice([a-zA-z0-9]+).'.$index,true);
			$item = $item[$index];
			switch (substr($item['hrDeviceType'],strrpos(':',$item['hrDeviceType']))) {
				case 'hrDeviceNetwork':
					$this->device->interfaces[] = new objInterface($item);
			}
		
		
		}
		
		// Storage/Memory Information
		foreach ($this->device->snmp->find('HOST-RESOURCES-MIB','hrStorageIndex') AS $key=>$index) {
			$item = $this->device->snmp->find('HOST-RESOURCES-MIB','hrStorage([a-zA-z0-9]+).'.$index,true);
			$item = $item[$index];
			switch (substr($item['hrStorageType'],strrpos(':',$item['hrStorageType']))) {
				case 'hrStorageRam':
					$this->device->ram = $item['hrStorageSize']*substr($item['hrStorageAllocationUnits'],0,strpos(' ',$item['hrStorageAllocationUnits']));
				case 'hrStorageVirtualMemory':
					$this->memory[$index] = new objMemory($item);
					break;
				case 'hrStorageFixedDisk':
					$this->storage[$index] = new objStorage($item);
					break;
					
			}
		}
	
		// Interfaces Information
		foreach ($this->device->snmp->find('IF-MIB','ifIndex') AS $key=>$index) {
			$item = $this->device->snmp->find('IF-MIB','if([a-zA-z0-9]+).'.$index,true);
			$item = $item[$index];
			$item['device_id'] = $this->device->id;
			$this->device->interfaces[$index] = new objInterface($item);
		}
	
	
	
	}
	
	public function checkDescription($sysDescr='') { return preg_match("/^IINET/", $sysDescr)?$this->id:'';	}
	public function getType() { return $this->device->os_type; }
	public function getDescription() { return $this->device->snmp->get('SNMPv2-MIB','sysDescr.0');}
	public function getUptime() { 
		return $this->device->snmp->get('DISMAN-EVENT-MIB','sysUpTimeInstance');
	}
}


?>